// 对于Ubuntu,IDE在/usr/include/下寻找头文件
#include <iostream>
#include <vector>
#include <string>
#include <dirent.h>
using namespace std;

// 获取指定目录的所有文件名
vector<string> getfiles(char **path)
{
    struct dirent *ptr;
    vector<string> files;
    DIR *dir;
    dir = opendir(path[1]);
    while ((ptr = readdir(dir)) != NULL)
    { //跳过'.'和'..'两个目录
        if (ptr->d_name[0] == '.')
            continue;
        files.push_back(ptr->d_name);
    }
    closedir(dir);
    return files;
}

int main(int argc, char **argv)
{
    vector<string> files;
    files = getfiles(argv);
    for (int i = 0; i < files.size(); ++i)
    {
        cout << files[i] << endl;
    }

    return 0;
}